/*--------------------------------+
| ArcEngine-CPlayer.cpp   		  |
|								  |
| BrokenGlass				      |
|								  |
| Last Change:					  |
+--------------------------------*/

#include "Global.h"

CPlayer::CPlayer()
{
	x = 100;
	y = 100;

	faceRight = true;
}

void CPlayer::move()
{
	if (xvel > 0)
		x +=xvel;
	else if (xvel < 0)
		x +=xvel;
	if (yvel > 0)
		y +=yvel;
	else if (yvel < 0)
		y +=yvel;
}

void CPlayer::getInput()
{
	xvel=0;
	yvel=0;
	if (keystates[SDLK_RIGHT])
	{
		xvel = 1;
		faceRight = true;
	}
	if (keystates[SDLK_LEFT])
	{
		xvel = -1;
		faceRight = false;
	}
	if (keystates[SDLK_UP])
		yvel = -1;
	if (keystates[SDLK_DOWN])
		yvel = 1;
}

void CPlayer::draw()
{
	if (faceRight)
		sPlayer[0].draw(x,y);
	else
		sPlayer[1].draw(x,y);
}

